<!--
*Author：jxx
 *Contact：283591387@qq.com
 *代码由框架生成,任何更改都可能导致被代码生成器覆盖
 *业务请在@/extension/system/workbusiness/EQU_PLCConfig.js此处编写
 -->
<template>
    <view-grid ref="grid"
               :columns="columns"
               :detail="detail"
               :editFormFields="editFormFields"
               :editFormOptions="editFormOptions"
               :searchFormFields="searchFormFields"
               :searchFormOptions="searchFormOptions"
               :table="table"
               :extend="extend">
    </view-grid>
</template>
<script>
    import extend from "@/extension/system/workbusiness/EQU_PLCConfig.js";
    import { ref, defineComponent } from "vue";
    export default defineComponent({
        setup() {
            const table = ref({
                key: 'EQUPLC_Id',
                footer: "Foots",
                cnName: 'PLC配置',
                name: 'workbusiness/EQU_PLCConfig',
                url: "/EQU_PLCConfig/",
                sortName: "CreateOn"
            });
            const editFormFields = ref({"EquipmentId":"","PlcNameZH":"","DbBlock":"","Offset":"","DbBlockType":"","PlcIP":"","DataType":"","Description":"","CurrentWriteValue":"","DBCode":""});
            const editFormOptions = ref([[{"dataKey":"设备","data":[],"title":"设备","field":"EquipmentId","type":"select"},
                               {"title":"名称","field":"PlcNameZH"},
                               {"title":"所选择的数据库块","field":"DbBlock","type":"number"},
                               {"title":"偏移量","field":"Offset","type":"number"}],
                              [{"dataKey":"Db类型","data":[],"title":"Db块类型","field":"DbBlockType","type":"select"},
                               {"title":"PLCip","field":"PlcIP","type":"text"},
                               {"dataKey":"PLC数据块类型","data":[],"title":"数据库块数据类型","field":"DataType","type":"select"},
                               {"title":"描述","field":"Description","type":"textarea"}],
                              [{"title":"写入值","field":"CurrentWriteValue","type":"text"},
                               {"title":"DbCode","field":"DBCode","type":"number"}]]);
            const searchFormFields = ref({"EquipmentId":"","PlcNameZH":"","DbBlock":"","DbBlockType":"","DataType":"","DBCode":""});
            const searchFormOptions = ref([[{"dataKey":"设备","data":[],"title":"设备","field":"EquipmentId","type":"select"},{"title":"名称","field":"PlcNameZH","type":"like"},{"title":"所选择的数据库块","field":"DbBlock","type":"decimal"},{"dataKey":"Db类型","data":[],"title":"Db块类型","field":"DbBlockType","type":"select"},{"dataKey":"PLC数据块类型","data":[],"title":"数据库块数据类型","field":"DataType","type":"select"},{"title":"DbCode","field":"DBCode","type":"text"}]]);
            const columns = ref([{field:'EQUPLC_Id',title:'EQUPLC_Id',type:'guid',width:110,hidden:true,readonly:true,require:true,align:'left'},
                       {field:'EquipmentId',title:'设备',type:'string',bind:{ key:'设备',data:[]},width:120,align:'left',sort:true},
                       {field:'PlcNameZH',title:'名称',type:'string',link:true,width:120,align:'left'},
                       {field:'DbBlock',title:'所选择的数据库块',type:'decimal',link:true,width:110,align:'left'},
                       {field:'DbBlockType',title:'Db块类型',type:'string',bind:{ key:'Db类型',data:[]},width:110,align:'left'},
                       {field:'PlcIP',title:'PLCip',type:'string',width:120,align:'left'},
                       {field:'DataType',title:'数据库块数据类型',type:'string',bind:{ key:'PLC数据块类型',data:[]},width:110,align:'left'},
                       {field:'Offset',title:'偏移量',type:'decimal',sort:true,width:110,align:'left'},
                       {field:'CurrentValue',title:'当前值',type:'string',width:120,align:'left'},
                       {field:'Description',title:'描述',type:'string',width:220,align:'left'},
                       {field:'Status',title:'新建/激活/保留/废除',type:'string',width:110,hidden:true,align:'left'},
                       {field:'CreateBy',title:'创建人',type:'string',width:110,hidden:true,align:'left'},
                       {field:'CreateOn',title:'创建时间',type:'datetime',width:150,hidden:true,align:'left',sort:true},
                       {field:'UpdateBy',title:'更新人',type:'string',width:110,hidden:true,align:'left'},
                       {field:'LastUpdateOn',title:'更新时间',type:'datetime',width:150,hidden:true,align:'left',sort:true},
                       {field:'IsDeleted',title:'逻辑删除 0/不删除 1/已删除',type:'bool',width:110,hidden:true,align:'left'},
                       {field:'CurrentWriteValue',title:'写入值',type:'string',width:120,align:'left'},
                       {field:'DBCode',title:'DbCode',type:'int',width:80,align:'left'}]);
            const detail = ref({
                cnName: "#detailCnName",
                table: "#detailTable",
                columns: [],
                sortName: "",
                key: ""
            });
            return {
                table,
                extend,
                editFormFields,
                editFormOptions,
                searchFormFields,
                searchFormOptions,
                columns,
                detail,
            };
        },
    });
</script>
